1. Field of the Invention
The present invention relates to an encoding apparatus using variable length encoding and, more particularly, to code amount control.
2. Related Background Art
In recent years, commercial VTRs for encoding an image signal with high efficiency, and recording/reproducing the encoded image signal on/from a recording medium such as a magnetic tape have been proposed.
As a technique for compressing and encoding an image signal with high efficiency, an encoding apparatus using orthogonal conversion is known. In this apparatus, after an image is divided into blocks (to be referred to as discrete cosine transform (DCT) blocks hereinafter) each consisting of a predetermined number of pixels, the DCT blocks are subjected to orthogonal conversion such as DCT conversion, and converted DCT coefficients are quantized to perform, e.g., entropy encoding.
As a method of high-efficiency encoding, a variable length encoding method with a high compression ratio tends to be used.
When data is recorded on a recording medium using variable length codes, it is desirable that a predetermined number of DCT blocks have a constant information amount in consideration of a special reproduction mode, error propagation, and the like.
A conventional encoding apparatus will be described below.
FIG. 1 is a block diagram of a conventional encoding apparatus. Note that two-dimensional DCT conversion is performed in units of small-size blocks each consisting of 8 pixels (horizontal)xc3x978 pixels (vertical) of an image signal, and the information amount is controlled to be constant in units of large-size blocks each consisting of 30 DCT blocks.
Referring to FIG. 1, a sample value of an image signal is input from an input terminal 1, and a large-size block forming circuit 2 selects 30 DCT blocks as a large-size block from 1-frame data according to an arbitrary rule.
This image signal is then supplied to a small-size block forming circuit 3, and is divided into small-size blocks each consisting of 8xc3x978 pixels.
A sample value of the image signal divided into the small-size blocks is input to an orthogonal conversion circuit 4, and the small-size blocks are DCT-converted, thus outputting 64 conversion coefficients in units of small-size blocks.
The conversion coefficients are stored in a buffer circuit 5 in units of large-size blocks, and are also supplied to a code amount calculation circuit 7. The code amount calculation circuit 7 calculates the code amount of each large-size block upon encoding, and outputs the calculation result to a quantizer selection circuit 8.
The quantizer selection circuit 8 selects a quantizer (or a quantization table) which can achieve a predetermined code amount, i.e., a code amount equal to or smaller than a target code amount, in accordance with the input result.
A quantizer 6 quantizes the conversion coefficients delayed by the buffer circuit 5 using the quantizer selected by the quantizer selection circuit 8. The quantized conversion coefficients are subjected variable length encoding such as Huffman encoding by a variable length encoding circuit 9, and the encoded data are output from an output terminal 10.
The conventional problems will be explained below with reference to FIGS. 2A and 2B.
FIGS. 2A and 2B show the relationship among a code amount achieved by a finally selected quantizer Qn, a code amount achieved by a quantizer Qnxe2x88x921, smaller by one than the quantizer Qn, and a target code amount. In FIGS. 2A and 2B, arrows a and b respectively represent the differences between the target code amount and the code amounts achieved by the quantizers Qn and Qnxe2x88x921, More specifically, when data is quantized by the quantizer Qn, the code amount is smaller by a than the target code amount. When data is quantized by the quantizer Qnxe2x88x921, the code amount exceeds the target code amount by b.
In the case of FIG. 2A, the value a is small, and encoding efficiency is high. However, in the case of FIG. 2B, the code amount is smaller by a considerably large value a than the target code amount, and encoding efficiency is low. In this case, the quantizer Qnxe2x88x921 is to be selected if possible. However, since the code amount quantized by the quantizer Qnxe2x88x921 slightly exceeds the target code amount by b, the quantizer Qn must be selected. In this manner, in the conventional apparatus, encoding with high efficiency cannot always be performed.
Conventional code amount control does not consider the visual characteristics of man. For example, the visual characteristics of man have steep discrimination characteristics for a relatively bright fine image, but have low identification ability for a dark fine image. Therefore, in the conventional control wherein the same quantization processing is performed for high-frequency components of low-luminance image data and those of middle- or high-luminance image data, high-frequency noise appears in a portion having a low luminance and a high degree of fineness, resulting in a visual obstacle.
Also, since the visual characteristics of man are lowered with respect to a moving image, image quality can be averaged by assigning a larger information amount to blocks with a small movement than blocks with a large movement. However, since the conventional method does not consider any movement, the above-mentioned control cannot be performed.
The present invention has been made in consideration of the above situation, and has as its object to provide a code amount control device, which can effectively use a target code amount without wasting as much as possible, and an encoding apparatus using the same.
In order to achieve the above object, according to a preferred aspect of the present invention, there is provided a code amount control device for controlling a code amount in units of second blocks each consisting of a plurality of first blocks each consisting of a plurality of sample value data, comprising quantization means for quantizing the second block data with predetermined quantization parameters, detection means for detecting a code amount of the second block data quantized by the quantization means, and control means for controlling the quantization parameters in units of first blocks in accordance with an output from the detection means.
It is another object of the present invention to provide an encoding apparatus which performs high-efficiency encoding in consideration of the visual characteristics of man.
In order to achieve the above object, according to another preferred aspect of the present invention, there is provided an encoding apparatus for dividing image information into blocks each consisting of a plurality of pixels, and encoding the image information by performing orthogonal conversion and quantization in units of blocks, comprising detection means for detecting local fineness characteristics of the image information from orthogonally converted conversion coefficients, and control means for controlling quantization characteristics in accordance with an output from the detection means.
Other objects and advantages of the invention will become apparent from the following detailed description taken in conjunction with the appended claims.